home *** CD-ROM | disk | FTP | other *** search
- class ActionWall extends State
- {
- var mcRef;
- var nType;
- var nSwitchRate;
- var nLife;
- static var sLINKAGE_NAME_DOOR = "mcDoor90";
- static var sLINKAGE_NAME_DOOR_INVERSE = "mcDoor90Inverse";
- static var sLINKAGE_NAME_REVOLVER = "mcRevolver";
- static var sLINKAGE_NAME_SLIDE_H = "mcSlideH";
- static var sLINKAGE_NAME_SLIDE_V = "mcSlideV";
- static var sSTATE_OPENED = "Opened";
- static var sSTATE_CLOSED = "Closed";
- static var sSTATE_OPENING = "Opening";
- static var sSTATE_CLOSING = "Closing";
- static var nCOUNTER = 0;
- static var nMIN_TIME = 40;
- static var nMAX_TIME = 120;
- function ActionWall(_nType, _nX, _nY, _xScl)
- {
- super(CTRLGame.getRef().mcRef.attachMovie(this.getLinkage(_nType),"mcMovingWall" + ActionWall.nCOUNTER,CTRLGame.getRef().calculateDepth(_nY,CTRLGame.nMOVING_WALL_ADD + ActionWall.nCOUNTER)));
- ActionWall.nCOUNTER = ActionWall.nCOUNTER + 1;
- this.mcRef._x = _nX;
- this.mcRef._y = _nY;
- this.mcRef._xscale = _xScl;
- var _loc7_ = CTRLGame.getRef().Maze.getTabIndex(this.mcRef._x,this.mcRef._y);
- if(CTRLGame.getRef().Maze.isPieceFlipped(_loc7_))
- {
- this.mcRef._xscale = - this.mcRef._xscale;
- }
- this.nType = _nType;
- this.setState(ActionWall.sSTATE_CLOSED);
- this.nSwitchRate = Math.round(Math.random() * (ActionWall.nMAX_TIME - ActionWall.nMIN_TIME)) + ActionWall.nMIN_TIME;
- this.nLife = this.nSwitchRate;
- }
- function cleanUp()
- {
- super.cleanUp();
- this.mcRef.swapDepths(7777);
- this.mcRef.removeMovieClip();
- }
- function get Type()
- {
- return this.nType;
- }
- function get Ref()
- {
- return this.mcRef;
- }
- function manageStaticState(_sNextState)
- {
- if(!Controller.getRef().isPaused() && !CTRLGame.getRef().Screen.isInMiniGame())
- {
- if(this.nLife > 0)
- {
- this.nLife = this.nLife - 1;
- }
- if(this.nLife == 0)
- {
- if(this.nType == CTRLGame.nREVOLVER_WALL)
- {
- if(CTRLGame.getRef().isOkayToTurnRevolver(this.mcRef.mcHit2,this.mcRef.mcHit2More))
- {
- this.setState(_sNextState);
- this.nLife = this.nSwitchRate;
- }
- }
- else if(CTRLGame.getRef().isOkayToTurn(this.mcRef.mcHit2))
- {
- this.setState(_sNextState);
- this.nLife = this.nSwitchRate;
- }
- }
- }
- }
- function getLinkage(_nType)
- {
- if(_nType == CTRLGame.nTURN_WALL)
- {
- var _loc3_ = ActionWall.sLINKAGE_NAME_DOOR;
- }
- else if(_nType == CTRLGame.nREVOLVER_WALL)
- {
- _loc3_ = ActionWall.sLINKAGE_NAME_REVOLVER;
- }
- else if(_nType == CTRLGame.nSLIDE_WALL_H)
- {
- _loc3_ = ActionWall.sLINKAGE_NAME_SLIDE_H;
- }
- else if(_nType == CTRLGame.nTURN_WALL_INVERSE)
- {
- _loc3_ = ActionWall.sLINKAGE_NAME_DOOR_INVERSE;
- }
- else
- {
- _loc3_ = ActionWall.sLINKAGE_NAME_SLIDE_V;
- }
- return _loc3_;
- }
- function Opened()
- {
- this.manageStaticState(ActionWall.sSTATE_CLOSING);
- }
- function Closing()
- {
- if(this.stateFinished())
- {
- this.setState(ActionWall.sSTATE_CLOSED);
- }
- }
- function Closed()
- {
- this.manageStaticState(ActionWall.sSTATE_OPENING);
- }
- function Opening()
- {
- if(this.stateFinished())
- {
- this.setState(ActionWall.sSTATE_OPENED);
- }
- }
- }
-